<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>s
    <meta charset="UTF-8">
    <title>微信支付html</title>
    <script type="text/javascript" src="../js/qrcode.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.1.0.js"></script>
</head>
<body>
<h1>支付</h1>

<td>orderNumber<input id='orderNumber' type='text'></td><br/>
<td>amount<input id='amount' type='number' value=0.01></td><br/>
<td>   userId<input id='userId' type='number' value=1></td><br/>
<td>   title<input id='title' type='text'value="测试"></td><br/>
<td>   description<input id='description' type='text' value="微信支付"></td><br/>
<button type="button" onclick="mySave()">支付</button>

</body>

<script>
    function mySave() {
        var JSONObject = {
            "orderNumber": $("#orderNumber").val()
            , "amount": $("#amount").val()
            , "userId": $("#userId").val()
            , "title": $("#title").val()
            , "description": $("#description").val()
        };
        $.ajax({
            type: "POST",
//            url: location.protocol + '//' + location.host + "/user/item/1",
            url:"http://localhost:8080/wechat/pay",
            data: JSONObject,
          dataType: "image/jpeg",
            success: function (data) {
//                $("body").html("<img src='" + data + "'/>");
                $("body").html("<img src='data:image/jpeg;base64," + data + "'/>");
//                $("body").html("<img src='http://localhost:8080/wechat/pay'/>");
            }
        });
    }
</script>


</html>
